﻿
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;

namespace Red.Controls.TimeLine.TrackItemsControls
{
    public class DurationEvent : Control
    {
        static DurationEvent()
        {
            DefaultStyleKeyProperty.OverrideMetadata( typeof( DurationEvent ), new FrameworkPropertyMetadata( typeof( DurationEvent ) ) );
        }

        #region Bar Dependency Properties

        public Brush BarBackground
        {
            get { return (Brush)GetValue( BarBackgroundProperty ); }
            set { SetValue( BarBackgroundProperty, value ); }
        }

        public Brush BarBorder
        {
            get { return (Brush)GetValue( BarForegroundProperty ); }
            set { SetValue( BarForegroundProperty, value ); }
        }

        public int BarHeight
        {
            get { return (int)GetValue( BarHeightProperty ); }
            set { SetValue( BarHeightProperty, value ); }
        }

        private static readonly DependencyProperty BarBackgroundProperty =
           DependencyProperty.Register( "BarBackground", typeof( Brush ), typeof( DurationEvent ),
               new FrameworkPropertyMetadata( new SolidColorBrush( Colors.LightGray ), FrameworkPropertyMetadataOptions.AffectsRender ) );

        private static readonly DependencyProperty BarForegroundProperty =
            DependencyProperty.Register( "BarBorder", typeof( Brush ), typeof( DurationEvent ),
                new FrameworkPropertyMetadata( new SolidColorBrush( Colors.DarkGray ), FrameworkPropertyMetadataOptions.AffectsRender ) );

        private static readonly DependencyProperty BarHeightProperty =
            DependencyProperty.Register( "BarHeight", typeof( int ), typeof( DurationEvent ),
                new UIPropertyMetadata( 16 ) );

        #endregion

        #region Dependency property

        public bool IsSelected
        {
            get { return (bool)GetValue( IsSelectedProperty ); }
            set { SetValue( IsSelectedProperty, value ); }
        }

        public static readonly DependencyProperty IsSelectedProperty =
            DependencyProperty.Register( "IsSelected", typeof( bool ), typeof( DurationEvent ),
                new PropertyMetadata( false ) );

        #endregion
    }
}
